package com.csl.jsonpreference.test

import com.google.gson.annotations.SerializedName


enum class CarMode(var type: Int, var modename: String) {
    /**
     * 普通双侧轮车
     */
    @SerializedName("01211")
    CAR_NOMAL(0, "普通双侧轮车"),
    @SerializedName("1222")
    CAR_ALL_MX(1, "X型麦克纳姆轮车"),
//    @SerializedName("23121")
    CAR_ALL_MO(2, "O型麦克纳姆轮车"),
    @SerializedName("325")
    CAR_ALL(3, "普通全向轮"),
    @SerializedName("431")
    CAR_VEER(4, "转向舵");


    companion object {
        fun getCarModeForCode(typeCode: Int): CarMode {
            for (d in values()) {
                if (d.type == typeCode) {
                    return d
                }
            }
            return CAR_NOMAL
        }
    }

    override fun toString(): String {
        return "$name: $modename($type)"
    }


}